#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>

#define fatal(test) do {if (test) {printf ("trash: %s\n", strerror(errno)); \
                       exit(EXIT_FAILURE);}} while(0)

int
main (int argc, char **argv)
{
  int pid, pid2, status;
  int f, c, i;
	f = 2;
	c = 0;


  printf ("Starting...\n");
	printf("cont = %d\n", i++);
	pid = fork();
	printf("cont = %d\n", i);

	printf ("%d F: \n\tPid = %5d, \n\tFather pid = %d \n\t Pid Atual = %d\n *********\n", f, pid, getppid(), getpid());



  return EXIT_SUCCESS;
}

/*Show details Hide details

Change log
r10 by renesp on Mar 17, 2009   Diff

Adicao do exemplo de fork do prof. Monaco

Go to: 	

Older revisions
All revisions of this file

File info
Size: 981 bytes, 55 lines
View raw file*/

